package com.java.thread.demo.chapter2.HasSelfPrivateNum;

/**
 * Created by yiyongyao on 2017/12/19.
 */
public class HasSelfPrivateNum {

    private int num = 0;

    synchronized public void addI(String username) {
        if (username.equals("a")) {
            num = 100;
            System.out.println("a set over");
        } else {
            num = 200;
            System.out.println("b set over");
        }
        System.out.println(username + " num= " + num);
    }

}
